/**
 *    Copyright 2006-2017 the original author or authors.
 *
 *    Licensed under the Apache License, Version 2.0 (the "License");
 *    you may not use this file except in compliance with the License.
 *    You may obtain a copy of the License at
 *
 *       http://www.apache.org/licenses/LICENSE-2.0
 *
 *    Unless required by applicable law or agreed to in writing, software
 *    distributed under the License is distributed on an "AS IS" BASIS,
 *    WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 *    See the License for the specific language governing permissions and
 *    limitations under the License.
 */
package org.mybatis.generator.plugins.custome;

import java.util.HashMap;
import java.util.Map;

/**
 * 异常错误码定义.
 *
 * @author <a href="http://www.jiangzezhou.com">jiangzezhou</a>
 * @version 1.0.0.0, 2/24/16 21::03
 */
public class ExceptionCode {

    static final Map<Integer, String> codeMap = new HashMap<Integer, String>() {
        {
            put(SYS_ERR, "系统异常");
            put(PARAMS_ERR, "参数异常");
            put(RPC_ERR, "RPC调用异常");
            put(BIZ_ERR, "业务异常");
            put(LAWYER_PHONE_EXITS, "律师手机号已经存在");
            put(PERMISSION_ERR,"无权限进行操作");
            put(NOT_SUPPORT,"不支持的操作");
        }
    };

    /**
     * 系统异常.
     */
    public static final int SYS_ERR = 10001;

    /**
     * 参数异常.
     */
    public static final int PARAMS_ERR = 10002;

    /**
     * 远程调用异常.
     */
    public static final int RPC_ERR = 10003;

    /**
     * 业务异常
     */
    public static final int BIZ_ERR = 10004;

    public static final int PERMISSION_ERR = 10005;

    /**
     * 不支持的操作.
     */
    public static final int NOT_SUPPORT = 10006;

    //**************业务异常20000为起始值********************//

    //律师手机号已经存在
    public static final int LAWYER_PHONE_EXITS = 20001;




    public static String getMsg(final int code) {
        final String msg = codeMap.get(code);
        if (msg == null) {
            return "unknown";
        }
        return msg;
    }


}
